
class Solution2 {
    public int missingNumber(int[] nums) {
        int n=nums.length;
        int ret=0;
        int i=0;

        for(i=0;i<n;i++){
            ret^=nums[i]^i;
        }

        return ret^i;


    }
}

class Solution1 {
    public boolean isUnique(String astr) {
        if(astr.length()>26) return false;
        int tmp=0;
        int c;
        for(int i=0;i<astr.length();i++){
            c=astr.charAt(i);
            if((tmp>>(c-'a')&1)==1) return false;
            else tmp=tmp|(1<<c-'a');

        }
        return true;

    }
}

class Solution {
    public int getSum(int a, int b) {
        while (b != 0) {
            int carry = (a & b) << 1;
            a = a ^ b;
            b = carry;
        }
        return a;
    }
}


class Solution4 {
    public int singleNumber(int[] nums) {
        int ret=0;
        for(int i=0;i<32;i++){
            int n=0;
            for(int j=0;j<nums.length;j++){
                n+=(nums[j]>>i)&1;
            }
            if(n%3!=0)  ret|=1<<i;
        }
        return ret;

    }
}


class Solution5 {
    public int[] missingTwo(int[] nums) {
        int n=nums.length;
        int tmp=nums[0];
        int[] ret=new int[2];
        for(int i=1;i<n;i++){
            tmp^=i^nums[i];
        }

        tmp^=(n+2)^(n+1)^n;

        int i=0;
        for(i=0;i<32;i++){
            if(((tmp>>i)&1)==1) break;
        }

        for(int num:nums){
            if(((num>>i)&1)==1) ret[0]^=num;
            else ret[1]^=num;
        }

        for(int j=1;j<=n+2;j++){
            if(((j>>i)&1)==1) ret[0]^=j;
            else ret[1]^=j;
        }

        return ret;

    }
}